import service from "../utils/service.ts";

// 商品接口
export interface Goods {
  attributeList: string;
  goodsId: number;
  goodsName: string;
  goodsPhoto: string;
  maxPrice: number;
  minPrice: number;
  pState: string;
  pcId: number;
}

// 商品规格接口
export interface GoodsSpecs {
  goodsId: number;
  goodsPrice: number;
  goodsSpecs: string;
  goodsStock: string;
  gsId: number;
}

// 订单商品接口
export interface OrderGoods {
  goods: Goods;
  goodsSpecs: GoodsSpecs;
  goodsSpecsId: number;
  ogId: number;
  ogNum: number;
  ogPrice: number;
  oid: number;
}

// 历史订单接口
export interface History {
  oAddressId: number;
  oConsignee: string;
  oId: number;
  oOrderTime: string;
  oPayTime: string;
  oPhone: string;
  oRemark: string;
  oState: number;
  oTotalPrice: number;
  orderGoodsList: OrderGoods[];
  userId: number;
}

// 获取历史订单列表
export const getHistoryList = (userId: string) => {
  return service.get(`/my-order/my-order-history-list/` + userId);
};

export const addOrder = (order) => {
  return service.post(`/my-order/add`, order)
}

export const getOrder = (orderId) => {
  return service.get(`/my-order/my-order-history-single/${orderId}`)
}
